package com.zw.admin.server.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zw.admin.server.model.PGoodsStockLogs;

@Mapper
public interface PGoodsStockLogsDao {

    @Select("select * from p_goods_stock_logs t where t.id = #{id}")
    PGoodsStockLogs getById(Long id);

    @Delete("delete from p_goods_stock_logs where id = #{id}")
    int delete(Long id);

    int update(PGoodsStockLogs pGoodsStockLogs);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into p_goods_stock_logs(item_no, sku, update_stock, stock, createTime) values(#{itemNo}, #{sku}, #{updateStock}, #{stock}, #{createTime})")
    int save(PGoodsStockLogs pGoodsStockLogs);
    
    int count(@Param("params") Map<String, Object> params);

    List<PGoodsStockLogs> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
    
    int insert(PGoodsStockLogs pGoodsStockLogs);  
}
